package com.fypg.module.medical.dal.mysql.doctor;

import java.util.*;

import com.fypg.framework.common.pojo.PageResult;
import com.fypg.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.fypg.framework.mybatis.core.mapper.BaseMapperX;
import com.fypg.module.medical.dal.dataobject.doctor.DoctorDO;
import org.apache.ibatis.annotations.Mapper;
import com.fypg.module.medical.controller.admin.doctor.vo.*;

/**
 * 医生信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DoctorMapper extends BaseMapperX<DoctorDO> {

    default PageResult<DoctorDO> selectPage(DoctorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DoctorDO>()
                .eqIfPresent(DoctorDO::getHospitalId, reqVO.getHospitalId())
                .eqIfPresent(DoctorDO::getDepartmentId, reqVO.getDepartmentId())
                .eqIfPresent(DoctorDO::getDepartmentEnCode, reqVO.getDepartmentEnCode())
                .eqIfPresent(DoctorDO::getEncode, reqVO.getEncode())
                .likeIfPresent(DoctorDO::getDoctorName, reqVO.getDoctorName())
                .eqIfPresent(DoctorDO::getAvatarUrl, reqVO.getAvatarUrl())
                .eqIfPresent(DoctorDO::getGenderType, reqVO.getGenderType())
                .eqIfPresent(DoctorDO::getIntroduction, reqVO.getIntroduction())
                .eqIfPresent(DoctorDO::getEducation, reqVO.getEducation())
                .eqIfPresent(DoctorDO::getSpecialty, reqVO.getSpecialty())
                .eqIfPresent(DoctorDO::getJobTitle, reqVO.getJobTitle())
                .likeIfPresent(DoctorDO::getPositionName, reqVO.getPositionName())
                .eqIfPresent(DoctorDO::getSortCode, reqVO.getSortCode())
                .eqIfPresent(DoctorDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(DoctorDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DoctorDO::getCreateUserId, reqVO.getCreateUserId())
                .likeIfPresent(DoctorDO::getCreateUserName, reqVO.getCreateUserName())
                .betweenIfPresent(DoctorDO::getModifyTime, reqVO.getModifyTime())
                .eqIfPresent(DoctorDO::getModifyUserId, reqVO.getModifyUserId())
                .likeIfPresent(DoctorDO::getModifyUserName, reqVO.getModifyUserName())
                .eqIfPresent(DoctorDO::getDeleteUserId, reqVO.getDeleteUserId())
                .likeIfPresent(DoctorDO::getDeleteUserName, reqVO.getDeleteUserName())
                .betweenIfPresent(DoctorDO::getDeleteTime, reqVO.getDeleteTime())
                .eqIfPresent(DoctorDO::getDeleteMark, reqVO.getDeleteMark())
                .eqIfPresent(DoctorDO::getRemark, reqVO.getRemark())
                .eqIfPresent(DoctorDO::getExtendData, reqVO.getExtendData())
                .orderByDesc(DoctorDO::getId));
    }

}